const saveImg = (imgSrc,name) => {
    var base64 = imgSrc.toString(); // imgSrc 就是base64哈
    var byteCharacters = atob(
      base64.replace(/^data:image\/(png|jpeg|jpg);base64,/, "")
    );
    var byteNumbers = new Array(byteCharacters.length);
    for (var i = 0; i < byteCharacters.length; i++) {
      byteNumbers[i] = byteCharacters.charCodeAt(i);
    }
    var byteArray = new Uint8Array(byteNumbers);
    var blob = new Blob([byteArray], {
      type: undefined,
    });
    var aLink = document.createElement("a");
    aLink.download = name + ".jpg"; //这里写保存时的图片名称
    aLink.href = URL.createObjectURL(blob);
    aLink.click();
  }

  export default saveImg;